/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package View;

import Control.ControlMedicalRecord;
import Entity.Veterinarian;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Nicolas
 */
public class VeterinarianInfoPanel extends javax.swing.JPanel {

    private Veterinarian veterianarian;
   
    public VeterinarianInfoPanel(Veterinarian vet, boolean update) {
        initComponents();
        this.veterianarian=vet;
        this.setVisible(true);
        name_text.setText(vet.getName());
            lastname_text.setText(vet.getLastName());
            ssn_text.setText(vet.getSSN());
            bdate_text.setText(vet.getBirthDate().toString());
            bplace_text.setText(vet.getBirthPlace());
            spec_text.setText(vet.getSpecialites());
            Integer salary = new Integer(vet.getSalary());
            salary_text.setText(salary.toString());
            focus_text.setText(vet.getFocusOfPractice());
            grad_text.setText(vet.getGraduatedAt());
         if (!update) {
            name_text.setEditable(false);
            lastname_text.setEditable(false);
             ssn_text.setEditable(false);
            bdate_text.setEditable(false);
            bplace_text.setEditable(false);
            spec_text.setEditable(false);
             salary_text.setEditable(false);
            focus_text.setEditable(false);
            grad_text.setEditable(false);
        }
            
            for (int x = 0; x < vet.getAppointments().size(); x++) {
                if (x < pets_table.getRowCount()) {
                    pets_table.setValueAt(vet.getAppointments().get(x).getMedicalRecord().getPet().getName(), x, 0);
                } else {
                    DefaultTableModel model = (DefaultTableModel) pets_table.getModel();
                    model.addRow(new Object[]{vet.getAppointments().get(x).getMedicalRecord().getPet().getName()});
                }
            


        }

    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        name_text = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        lastname_text = new javax.swing.JTextField();
        ssn_text = new javax.swing.JTextField();
        bdate_text = new javax.swing.JTextField();
        bplace_text = new javax.swing.JTextField();
        focus_text = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        salary_text = new javax.swing.JTextField();
        grad_text = new javax.swing.JTextField();
        spec_text = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        pets_table = new javax.swing.JTable();

        setMaximumSize(new java.awt.Dimension(465, 284));
        setMinimumSize(new java.awt.Dimension(465, 284));

        jLabel1.setText("Veterinarian");

        jLabel2.setText("Name");

        jLabel3.setText("Last Name");
        jLabel3.setMaximumSize(new java.awt.Dimension(27, 14));
        jLabel3.setMinimumSize(new java.awt.Dimension(27, 14));
        jLabel3.setPreferredSize(new java.awt.Dimension(27, 14));

        jLabel4.setText("SSN");
        jLabel4.setMaximumSize(new java.awt.Dimension(27, 14));
        jLabel4.setMinimumSize(new java.awt.Dimension(27, 14));
        jLabel4.setPreferredSize(new java.awt.Dimension(27, 14));

        jLabel5.setText("BirthDate");
        jLabel5.setMaximumSize(new java.awt.Dimension(27, 14));
        jLabel5.setMinimumSize(new java.awt.Dimension(27, 14));
        jLabel5.setPreferredSize(new java.awt.Dimension(27, 14));

        jLabel6.setText("BirthPlace");
        jLabel6.setMaximumSize(new java.awt.Dimension(27, 14));
        jLabel6.setMinimumSize(new java.awt.Dimension(27, 14));
        jLabel6.setPreferredSize(new java.awt.Dimension(27, 14));

        jLabel7.setText("Focus of Practice");

        jLabel8.setText("Specialities");

        jLabel9.setText("Salary");

        jLabel10.setText("Graduated At");

        pets_table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "Pets Atended"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(pets_table);
        pets_table.getColumnModel().getColumn(0).setResizable(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(grad_text))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(salary_text))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
                                    .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(bdate_text, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE)
                            .addComponent(bplace_text)
                            .addComponent(ssn_text, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lastname_text)
                            .addComponent(name_text)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(focus_text)
                            .addComponent(spec_text))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(name_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lastname_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ssn_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(bdate_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(bplace_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(focus_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(spec_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9)
                            .addComponent(salary_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel10)
                            .addComponent(grad_text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField bdate_text;
    private javax.swing.JTextField bplace_text;
    private javax.swing.JTextField focus_text;
    private javax.swing.JTextField grad_text;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField lastname_text;
    private javax.swing.JTextField name_text;
    private javax.swing.JTable pets_table;
    private javax.swing.JTextField salary_text;
    private javax.swing.JTextField spec_text;
    private javax.swing.JTextField ssn_text;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the veterianarian
     */
    public Veterinarian getVeterianarian() {
        return veterianarian;
    }

    /**
     * @param veterianarian the veterianarian to set
     */
    public void setVeterianarian(Veterinarian veterianarian) {
        this.veterianarian = veterianarian;
    }

    /**
     * @return the bdate_text
     */
    public javax.swing.JTextField getBdate_text() {
        return bdate_text;
    }

    /**
     * @param bdate_text the bdate_text to set
     */
    public void setBdate_text(javax.swing.JTextField bdate_text) {
        this.bdate_text = bdate_text;
    }

    /**
     * @return the bplace_text
     */
    public javax.swing.JTextField getBplace_text() {
        return bplace_text;
    }

    /**
     * @param bplace_text the bplace_text to set
     */
    public void setBplace_text(javax.swing.JTextField bplace_text) {
        this.bplace_text = bplace_text;
    }

    /**
     * @return the focus_text
     */
    public javax.swing.JTextField getFocus_text() {
        return focus_text;
    }

    /**
     * @param focus_text the focus_text to set
     */
    public void setFocus_text(javax.swing.JTextField focus_text) {
        this.focus_text = focus_text;
    }

    /**
     * @return the grad_text
     */
    public javax.swing.JTextField getGrad_text() {
        return grad_text;
    }

    /**
     * @param grad_text the grad_text to set
     */
    public void setGrad_text(javax.swing.JTextField grad_text) {
        this.grad_text = grad_text;
    }

    /**
     * @return the jLabel1
     */
    public javax.swing.JLabel getjLabel1() {
        return jLabel1;
    }

    /**
     * @param jLabel1 the jLabel1 to set
     */
    public void setjLabel1(javax.swing.JLabel jLabel1) {
        this.jLabel1 = jLabel1;
    }

    /**
     * @return the jLabel10
     */
    public javax.swing.JLabel getjLabel10() {
        return jLabel10;
    }

    /**
     * @param jLabel10 the jLabel10 to set
     */
    public void setjLabel10(javax.swing.JLabel jLabel10) {
        this.jLabel10 = jLabel10;
    }

    /**
     * @return the jLabel2
     */
    public javax.swing.JLabel getjLabel2() {
        return jLabel2;
    }

    /**
     * @param jLabel2 the jLabel2 to set
     */
    public void setjLabel2(javax.swing.JLabel jLabel2) {
        this.jLabel2 = jLabel2;
    }

    /**
     * @return the jLabel3
     */
    public javax.swing.JLabel getjLabel3() {
        return jLabel3;
    }

    /**
     * @param jLabel3 the jLabel3 to set
     */
    public void setjLabel3(javax.swing.JLabel jLabel3) {
        this.jLabel3 = jLabel3;
    }

    /**
     * @return the jLabel4
     */
    public javax.swing.JLabel getjLabel4() {
        return jLabel4;
    }

    /**
     * @param jLabel4 the jLabel4 to set
     */
    public void setjLabel4(javax.swing.JLabel jLabel4) {
        this.jLabel4 = jLabel4;
    }

    /**
     * @return the jLabel5
     */
    public javax.swing.JLabel getjLabel5() {
        return jLabel5;
    }

    /**
     * @param jLabel5 the jLabel5 to set
     */
    public void setjLabel5(javax.swing.JLabel jLabel5) {
        this.jLabel5 = jLabel5;
    }

    /**
     * @return the jLabel6
     */
    public javax.swing.JLabel getjLabel6() {
        return jLabel6;
    }

    /**
     * @param jLabel6 the jLabel6 to set
     */
    public void setjLabel6(javax.swing.JLabel jLabel6) {
        this.jLabel6 = jLabel6;
    }

    /**
     * @return the jLabel7
     */
    public javax.swing.JLabel getjLabel7() {
        return jLabel7;
    }

    /**
     * @param jLabel7 the jLabel7 to set
     */
    public void setjLabel7(javax.swing.JLabel jLabel7) {
        this.jLabel7 = jLabel7;
    }

    /**
     * @return the jLabel8
     */
    public javax.swing.JLabel getjLabel8() {
        return jLabel8;
    }

    /**
     * @param jLabel8 the jLabel8 to set
     */
    public void setjLabel8(javax.swing.JLabel jLabel8) {
        this.jLabel8 = jLabel8;
    }

    /**
     * @return the jLabel9
     */
    public javax.swing.JLabel getjLabel9() {
        return jLabel9;
    }

    /**
     * @param jLabel9 the jLabel9 to set
     */
    public void setjLabel9(javax.swing.JLabel jLabel9) {
        this.jLabel9 = jLabel9;
    }

    /**
     * @return the jScrollPane1
     */
    public javax.swing.JScrollPane getjScrollPane1() {
        return jScrollPane1;
    }

    /**
     * @param jScrollPane1 the jScrollPane1 to set
     */
    public void setjScrollPane1(javax.swing.JScrollPane jScrollPane1) {
        this.jScrollPane1 = jScrollPane1;
    }

    /**
     * @return the lastname_text
     */
    public javax.swing.JTextField getLastname_text() {
        return lastname_text;
    }

    /**
     * @param lastname_text the lastname_text to set
     */
    public void setLastname_text(javax.swing.JTextField lastname_text) {
        this.lastname_text = lastname_text;
    }

    /**
     * @return the name_text
     */
    public javax.swing.JTextField getName_text() {
        return name_text;
    }

    /**
     * @param name_text the name_text to set
     */
    public void setName_text(javax.swing.JTextField name_text) {
        this.name_text = name_text;
    }

    /**
     * @return the pets_table
     */
    public javax.swing.JTable getPets_table() {
        return pets_table;
    }

    /**
     * @param pets_table the pets_table to set
     */
    public void setPets_table(javax.swing.JTable pets_table) {
        this.pets_table = pets_table;
    }

    /**
     * @return the salary_text
     */
    public javax.swing.JTextField getSalary_text() {
        return salary_text;
    }

    /**
     * @param salary_text the salary_text to set
     */
    public void setSalary_text(javax.swing.JTextField salary_text) {
        this.salary_text = salary_text;
    }

    /**
     * @return the spec_text
     */
    public javax.swing.JTextField getSpec_text() {
        return spec_text;
    }

    /**
     * @param spec_text the spec_text to set
     */
    public void setSpec_text(javax.swing.JTextField spec_text) {
        this.spec_text = spec_text;
    }

    /**
     * @return the ssn_text
     */
    public javax.swing.JTextField getSsn_text() {
        return ssn_text;
    }

    /**
     * @param ssn_text the ssn_text to set
     */
    public void setSsn_text(javax.swing.JTextField ssn_text) {
        this.ssn_text = ssn_text;
    }

    void updateVeterinarian() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
